﻿using RpcCentral.Model;
using RpcCentral.Model.DB;
using SqlSugarHelper;

namespace RpcCentral.DAL.Repository
{
    internal class RemoteServerTypeDAL : IRemoteServerTypeDAL
    {
        private IRepository<RemoteServerType> _Db;
        public RemoteServerTypeDAL(IRepository<RemoteServerType> db)
        {
            _Db = db;
        }
        public SystemTypeDatum GetSystemType(string typeVal)
        {
            return this._Db.Get(c => c.TypeVal == typeVal, c => new SystemTypeDatum
            {
                BalancedType = c.BalancedType,
                DefPort = c.DefPort,
                GroupId = c.GroupId,
                Id = c.Id,
                SystemName = c.SystemName
            });
        }
        public long GetSystemTypeId(string typeVal)
        {
            return this._Db.Get(c => c.TypeVal == typeVal, c =>c.Id);
        }
    }
}
